// 用户信息模块(局部模块)
export default {
    state() {
      return {
        id: '',
        userName: '',
        nickName: '',
        userType: '',
        avatar: '',
      }
    },
    mutations: {
      setId(state: { id: bigint; }, id: bigint) {
        state.id = id;
      },
      setUserName(state: { userName: string; }, userName: string) {
        state.userName = userName;
      },
      setNickName(state: { nickName: string; }, nickName: string) {
        state.nickName = nickName;
      },
      setUserType(state: { userType: string; }, userType: string) {
        state.userType = userType;
      },
      setAvatar(state: { avatar: string; }, avatar: string) {
        state.avatar = avatar;
      },
    },
    actions: {
      updateUserInfo({ commit }: any, user: { id: bigint; userName: string; nickName: string; userType: string; avatar: string; }) {
        commit('setId', user.id);
        commit('setUserName', user.userName);
        commit('setNickName', user.nickName);
        commit('setUserType', user.userType);
        commit('setAvatar', user.avatar);
      },
    },
    getters: {
      getUserInfo(state: any) {
        return state;
      },
    }
  }
  
  